package pure.ui.groups 
{
	import pure.ui.Button;
	import pure.ui.skins.IClickSkin;
	import pure.ui.skins.ISkin;
	import flash.geom.Point;
	
	/**
	 * 普通按钮组合
	 * @author Des
	 * <皮肤种类> ---- IClickSkin
	 * 
	 * <TODO> 支持按下连续触发功能，间隔最好不低于0.1秒！
	 */
	
public class ButtonBar extends GroupBase 
{
	public function ButtonBar(x:Number, y:Number,skin:ISkin=null)
	{
		super(x, y,skin);
	}


	
	
	
	
	
	/**
	 * 观察点击状态
	 * @param observer		回调方法
	 **/
	public function setObserverClick(observer:Function):void
	{
		var item:Button;
		for (var i:int = 0; i < _numItem; i++)
		{
			item = _items[i];
			item.setObserverClick(observer);
		}
	}
	
	/**
	 * 按住连续触发回调
	 * @param observer			回调方法
	 **/
	public function setObserverButtonDown(observer:Function):void
	{
		var item:Button;
		for (var i:int = 0; i < _numItem; i++)
		{
			item = _items[i];
			item.setObserverButtonDown(observer);
		}
	}
	

	
	
	
	/* ----------------------------------------------------    get / set    ----------------------------------------------------*/
	
	
	
	
	
	// 皮肤
	override public function set skin(value:ISkin):void
	{
		if (!value is IClickSkin)
		{
			throw new Error('ButtonBar::skin - 皮肤类型错误！');
		}
		super.skin = value;
	}	

	// 按钮按住事件派发间隔(秒)
	public function set interval(value:Number):void
	{
		var item:Button;
		for (var i:int = 0; i < _numItem; i++)
		{
			item = _items[i];
			item.interval = value;
		}
	}
	
	
	
	
	
	/* ----------------------------------------------------    private    ----------------------------------------------------*/

	
	
	
	
	/**
	 * 生成组件项目
	 * @param htmlLabel
	 * @param x
	 * @param y
	 * @param itemSize
	 * @param skin
	 **/
	override protected function _createItem(x:Number,y:Number,itemSize:Point,skin:ISkin,hasLabel:Boolean):IGroupItem
	{
		var item:Button = new Button(x, y, itemSize, skin, hasLabel);
		item.group = this;
		return item;
	}
}

}